<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Root Managerment</title>
</head>
<body>
	<h2 align="center">Welcome</h2>
	<hr>
	Root管理员，欢迎您登陆！
	<br>
	<br>
	<s:form action="RootselectManagerByNameLike">
		<s:textfield name="ManagerName" label="管理员名检索"></s:textfield>
		<s:submit value="确定" />
	</s:form>
	<br>
	<br>
	
	<!-- 创建一个基本的ManagerTable表 -->
	<table id="ManagerTable" border="1">
		<tr>
			<td>managerId</td>
			<td>managerName</td>
			<td>password</td>
			<td>managerAge</td>
			<td>managerPower</td>
		</tr>
		<tr>
			<td>100</td>
			<td>wangqihua</td>
			<td>1234</td>
			<td>25</td>
			<td>1</td>
		</tr>
	</table>
	
	<!-- 向ManagerTable中填充数据 -->
	<script type="text/javascript">
		var table = document.getElementById("ManagerTable");
		var caption = table.createCaption();
		caption.innerHTML = "管理员信息表";
		var tr = table.insertRow(2);
		var td = tr.insertCell(0);
		td.innerHTML = "<s:property value='managerName'/>";
	</script>
	
	<!-- 修改ManagerTable表 -->
	改变第
	<input id="row" type="text" size="2" />行，第
	<input id="col" type="text" size="2" />列的值为：
	<input id="value" type="text" size="16" />
	<input id="chg" type="button" value="改变" onclick="change();" />
	<script type="text/javascript">
		var change = function() {
			var table = document.getElementById("ManagerTable");
			var row = document.getElementById("row").value;
			row = parseInt(row);
			if (isNaN(row)) {
				alert("您需要修改的行必须是整数");
				return false;
			}
			var col = document.getElementById("col").value;
			col = parseInt(col);
			if (isNaN(col)) {
				alert("您需要修改的列必须是整数");
				return false;
			}
			if (row > table.rows.length
					|| col > table.rows.item(0).cells.length) {
				alert("您输入的行列不在表格内");
				return false;
			}
			table.rows.item(row - 1).cells.item(col - 1).innerHTML = document
					.getElementById("value").value;
		}
	</script>
</body>
</html>